from selenium import webdriver
import time, unittest
from selenium.webdriver.common.by import By
from selenium.webdriver.support.select import Select

class jiuxian(unittest.TestCase):
    def test_login(self):
        # 打开Edge浏览器
        driver = webdriver.Edge()
        # 进入酒仙网
        driver.get('https://www.jiuxian.com/')
        # 窗口最大化
        driver.maximize_window()
        # 点击请登录
        driver.find_element(By.CLASS_NAME, 'headerLogin').click()
        # 输入用户名
        driver.find_element(By.ID, 'userName').send_keys('15523615751')
        # 输入密码
        driver.find_element(By.ID, 'password').send_keys('lj070130.')
        time.sleep(15)
        # 点击登录
        driver.find_element(By.NAME, 'bi_Usuallogin').click()
        time.sleep(3)
        # 弹窗确定
        driver.find_element(By.ID, 'bindSub').click()
        time.sleep(6)
# # 点击我的酒仙
# driver.find_element(By.XPATH, '/html/body/div[2]/div/div[2]/ul/li[1]/div[1]/a').click()
# driver.switch_to.window(driver.window_handles[-1])
# time.sleep(3)
# # 关闭弹窗
# driver.find_element(By.CLASS_NAME, 'uGuideClose').click()
# time.sleep(2)
# # 下滑
# driver.execute_script('window.scrollTo(0,600)')
# time.sleep(2)
# # 点击收货地址
# driver.find_element(By.XPATH, '/html/body/div[4]/div[1]/div[2]/div[4]/a[3]/span').click()
# time.sleep(2)
# # 输入收货人
# driver.find_element(By.ID, 'people').send_keys('小六')
# time.sleep(2)
# # 选择省份
# province = Select(driver.find_element(By.ID, 'province'))
# province.select_by_value('2')
# time.sleep(1)
# # 选择市
# city = Select(driver.find_element(By.ID, 'city'))
# city.select_by_value('52')
# time.sleep(1)
# # 选择区
# district = Select(driver.find_element(By.ID, 'district'))
# district.select_by_value('512')
# time.sleep(1)